﻿using System;
using System.ComponentModel;
using System.Linq.Expressions;
using MC.Warehouse.Core;

namespace MC.Warehouse.ViewModels
{
    public class BaseViewModel : INotifyPropertyChanged
    {
        #region CONTRUCTOR

        #endregion

        #region INTERFACE NOTIFY PROPERTY CHANGED

        public event PropertyChangedEventHandler PropertyChanged;

        public void NotifyPropertyChanged(String propertiesName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertiesName));
            }
        }

        public void NotifyPropertyChanged<T>(Expression<Func<T>> propertyExpression)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyExpression.GetPropertyName()));
            }
        }

        #endregion
    }
}
